﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Db8
{
    public class ClientSettings
    {

        public static string StickyFilter
        {
            get
            {
                if (HttpContext.Current.Items["StickyFilter"] == null)
                {
                    if (HttpContext.Current.Request.Cookies.AllKeys.Contains("StickyFilter"))
                    {
                        HttpContext.Current.Items["StickyFilter"] = HttpContext.Current.Request.Cookies["StickyFilter"].Value;
                    }
                    else
                    {
                        HttpContext.Current.Items["StickyFilter"] = "";
                    }
                }
                return HttpContext.Current.Items["StickyFilter"] as string;
            }
            set
            {
                HttpContext.Current.Items["StickyFilter"] = value;
                HttpContext.Current.Response.Cookies["StickyFilter"].Value = value;
                HttpContext.Current.Response.Cookies["StickyFilter"].Expires = DateTime.Now.AddDays(14);
            }
        }


        public static string ViewMode
        {
            get
            {
                if (HttpContext.Current.Items["ViewMode"] == null)
                {
                    if (HttpContext.Current.Request.Cookies.AllKeys.Contains("ViewMode"))
                    {
                        HttpContext.Current.Items["ViewMode"] = HttpContext.Current.Request.Cookies["ViewMode"].Value;
                    }
                    else
                    {
                        HttpContext.Current.Items["ViewMode"] = "";
                    }
                }
                return HttpContext.Current.Items["ViewMode"] as string;
            }
            set
            {
                HttpContext.Current.Items["ViewMode"] = value;
                HttpContext.Current.Response.Cookies["ViewMode"].Value = value;
                HttpContext.Current.Response.Cookies["ViewMode"].Expires = DateTime.Now.AddDays(14);
            }
        }

    }
}